#pragma once

#include "Common/ChatDefine.h"
#include "base/core/singleton.h"
#include "Common/NetPack/NetPack.h"
#include "Common/CharacterDefine.h"

class Player;

class ChatManager : public ManualSingleton<ChatManager>
{
public:
	ChatManager();
	virtual ~ChatManager();

public:
	bool Init();
	bool UnInit();

	//********************传闻或广播新接口***************************//

	/*
	* 函数功能：指定接收玩家广播接口
	* @param id   			传闻广播定义id
	* @param msgData 		传闻广播需填充数据
	* @param playerIdList	接收消息的玩家id列表
	*
	*/
	void SendBroadcastChat(BROADCAST_TYPE id, SystemChatMsgData& msgData, std::vector<CharIDType>& playerIdList);

	/*
	* 函数功能：请求世界服转发传闻或广播
	* @param id   			传闻广播定义id
	* @param msgData 		广播需填充数据
	* @param extraId 		额外id数据，例如工会id 队伍id 阵营id等等  用于世界服查询接收的玩家id列表
	*
	*/
	void SendG2WBroadcast(BROADCAST_TYPE id, SystemChatMsgData& msgData, uint32_t extraId = 0);



public:
	/***初始化SystemChatMsgData部分成员的接口***/
	void InitPlayerMiniInfoStruct(Player* pPlayer, ProtoBuf::CharacterPlayerMiniInfo& info);		//初始化Chat_PlayerMiniInfo结构体


private:
	//向部分玩家发送消息
	void SendG2CChat(uint32_t cmd, std::vector<CharIDType>& playerIdList, ProtoBufBase* msg);

	//逻辑服跟世界服之间通讯 与人物无关
	void SendSysG2W(uint32_t cmd, ProtoBufBase* msg);
};

#define g_MakeChatMgr() (ChatManager::Instance())
#define g_GetChatMgr()  (ChatManager::GetInstance())
#define g_DelChatMgr()  (ChatManager::Destroy())
